package cn.hl.basic.util;

/**
 * 数据处理是否成功的公共方法
 */
public class AjaxResult {

    /** 操作结果 */
    private Boolean success = true;

    /** 信息提示 */
    private String message = "操作成功";

    /** 保存其他信息 */
    private Object resultObj;

    public AjaxResult() {
    }

    public static AjaxResult me() {
        return new AjaxResult();
    }

    public AjaxResult(Boolean success, String message) {
        this.success = success;
        this.message = message;
    }

    public AjaxResult(Boolean success, String message, Object resultObj) {
        this.success = success;
        this.message = message;
        this.resultObj = resultObj;
    }

    public Boolean getSuccess() {
        return success;
    }

    public AjaxResult setSuccess(Boolean success) {
        this.success = success;
        return this;
    }

    public String getMessage() {
        return message;
    }

    public AjaxResult setMessage(String message) {
        this.message = message;
        return this;
    }

    public Object getResultObj() {
        return resultObj;
    }

    public AjaxResult setResultObj(Object resultObj) {
        this.resultObj = resultObj;
        return this;
    }

    @Override
    public String toString() {
        return "AjaxResult{" +
                "success=" + success +
                ", message='" + message + '\'' +
                ", resultObj=" + resultObj +
                '}';
    }
}
